<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 500px;
        height: 200px;
        border: 1px solid #000;
      }
    </style>
  </head>
  <body>
    <button class="bbb">点击</button>
    <div></div>
    <div></div>
    <script>
      //获取div元素
      var ddd = document.querySelectorAll('div');
      //1.事件源
      var bbb = document.querySelector('.bbb');
      //2. 事件类型
      bbb.onclick = function () {
        //3.做什么事情
        ddd[0].innerHTML = '<h2>下课了</h2>';
        ddd[1].innerText = '<h2>下课了</h2>';
      };
    </script>
  </body>
</html>
